package com.wanbatv.wangwangba.presenter;

import com.wanbatv.wangwangba.model.MainModel;
import com.wanbatv.wangwangba.model.OnMainListener;
import com.wanbatv.wangwangba.model.OnPayListener;
import com.wanbatv.wangwangba.model.OnWechatListener;
import com.wanbatv.wangwangba.model.PayModel;
import com.wanbatv.wangwangba.model.WechatModel;
import com.wanbatv.wangwangba.model.entity.DogtvData;
import com.wanbatv.wangwangba.model.entity.EncyclopediasData;
import com.wanbatv.wangwangba.model.entity.HomepageData;
import com.wanbatv.wangwangba.model.entity.PayData;
import com.wanbatv.wangwangba.model.entity.TrailerData;
import com.wanbatv.wangwangba.model.entity.WechatData;
import com.wanbatv.wangwangba.model.imple.MainModelImple;
import com.wanbatv.wangwangba.model.imple.PayModelImple;
import com.wanbatv.wangwangba.model.imple.WechatModelImple;
import com.wanbatv.wangwangba.view.MainView;

import java.util.List;

/**
 * Created by 俞亚楠 on 2016/7/19.
 */
public class MainPresenter implements OnMainListener,OnPayListener,OnWechatListener {
    private MainModel mainModel;
    private MainView mainView;
    private PayModel payModel;
    private WechatModel wechatModel;



    public MainPresenter(MainView mainView) {
        this.mainView=mainView;
        mainModel=new MainModelImple(mainView.getContextFromAct());
        payModel=new PayModelImple(mainView.getContextFromAct());
        wechatModel=new WechatModelImple(mainView.getContextFromAct());

    }

    @Override
    public void onLoadHomepageData(List<HomepageData.DataBean.ListBean> list) {
        mainView.showHomepageData(list);
    }

    @Override
    public void onLoadWechatData(List<WechatData.MediaListBean> mediaListBean, List<WechatData.UserListBean> userListBean, String qrUrl) {
        mainView.showWechatData(mediaListBean,userListBean,qrUrl);
    }

    @Override
    public void onLoadDagtvData(List<DogtvData.DataBean.ListBean> listBeen) {
        mainView.showDogtvData(listBeen);
    }

    @Override
    public void onLoadEncyclopediasData(List<EncyclopediasData.DataBean.ListBean> listBeen) {
        mainView.showEncyclopediasData(listBeen);
    }

    @Override
    public void onLoadWangwangshowData() {
        mainView.showWangwangshowData();
    }

    @Override
    public void onloadTrailerData(List<TrailerData.DataBean.LoopPlaylistBean> loopPlaylistBeen) {
        mainView.showTrailerData(loopPlaylistBeen);
    }

    @Override
    public void onloadAuthenticationData(boolean payCompleted) {
        mainView.getAuthentication(payCompleted);
    }

    @Override
    public void onloadPayData(List<PayData.DataBean.ListBean> listBeen,int monthoryear) {
        mainView.getPayData(listBeen,monthoryear);
    }

    @Override
    public void onloadOrder(String subject,String subjectId,String price,String order) {
        mainView.getOrderData(subject,subjectId,price,order);
    }

    public void loadHomepageData(){
        mainModel.setHomepageData(this);
    }
    public void loadWechatData(){
        wechatModel.setWechatData(this);
    }
    public void loadDogtvData(){
        mainModel.setDogtvData(this);
    }
    public void loadEncyclopediasData(){
        mainModel.setEncyclopedias(this);
    }
    public void loadWangwangshow(){
        mainModel.setWangwangshow(this);
    }
    public void tonextDogtvActivity(int num){
        mainView.toDogtvActivity(num);
    }
    public void tonextEncyclopediasActivity(String token){
        mainView.toEncyclopediasActivity(token);
    }
    public void tonextWangwangshowActivity(String token,String content_name){
        mainView.toWangwangshowPlayActivity(token,content_name);
    }
    public void loadsetTrailerData(){
        mainModel.setTrailer(this);
    }
    public void loadsetAuthentication(){
        payModel.setAuthentication(this);
    }
    public void loadsetPayData(int monthoryear){
        payModel.setPay(this,monthoryear);
    }
    public void loadsetOrder(String subject,String subjectId,String price,String order,String provider){
        payModel.setOrder(this,subject,subjectId,price,provider);
    }


}
